class Machine < ActiveRecord::Base
  has_many :port_entries
  has_many :installed_applications
  has_and_belongs_to_many :categories
  
  def self.num_of
    return self.find(:all).length
  end
  
  def self.num_wo_cat
    machines_wo_cat = 0
    for machine_temp in self.find(:all)
      if machine_temp.categories.collect{ |cat| cat.name }.size == 0
        machines_wo_cat += 1
      end
    end
    return machines_wo_cat
  end
end
